import Taro, {Component} from '@tarojs/taro'
import {View, Button, Text} from '@tarojs/components'
import {connect} from '@tarojs/redux'


import './index.scss'

@connect(({common}) => ({test: common.test, number: common.number}))
class Index extends Component {

    config = {
        navigationBarTitleText: '首页'
    }

    componentWillReceiveProps(nextProps) {
        console.log(this.props, nextProps)
    }

    componentWillUnmount() {
    }

    componentDidShow() {
    }

    componentDidHide() {
    }

    render() {
        return (<View className='index'>
                <Button className='dec_btn'
                  onClick={this.props.dispatch.common.addAsync}
                > async </Button>
                <View> <Text> {this.props.number} </Text></View>
                <View> <Text> {this.props.test.username} {this.props.test.password} </Text></View>
            </View>
        )
    }
}

export default Index